/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.vaadin.demo.dashboard;

import com.quick.global.GlobalConstants;
import com.vaadin.event.LayoutEvents;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.server.ExternalResource;
import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.ui.*;
import java.util.ArrayList;
import java.util.List;
import org.vaadin.tepi.imageviewer.ImageViewer;

import org.vaadin.tepi.imageviewer.widgetset.client.ui.ImageViewerServerRpc;
import org.vaadin.tepi.imageviewer.widgetset.client.ui.ImageViewerState;

/**
 *
 * @author suyogn
 */
public class GalleryView extends VerticalLayout implements View, LayoutEvents.LayoutClickListener{
    
    
    private HorizontalLayout row ;
    
    @Override
    public void enter(ViewChangeEvent event) {
        setSizeFull();
        addStyleName("schedule");
        setMargin(false);
        setSizeFull();
    }
    
    
    public GalleryView()
    {
        
      /*  HorizontalLayout topDummy = new HorizontalLayout();
        topDummy.setWidth("100%");
        topDummy.setSpacing(true);
        topDummy.setMargin(true);
        topDummy.addStyleName("whiteBg");
        
        Label dummyWhiteLabel = new Label(GlobalConstants.emptyString);
        topDummy.addComponent(dummyWhiteLabel);
        topDummy.setComponentAlignment(dummyWhiteLabel, Alignment.MIDDLE_LEFT);
        topDummy.setExpandRatio(dummyWhiteLabel, 1);
        
        addComponent(topDummy);
        
        final Label title = new Label("Image Gallery");
        title.setSizeUndefined();
        title.addStyleName("selectedMenuBanner");
        
        HorizontalLayout top = new HorizontalLayout();
        top.setWidth("100%");
        top.setSpacing(true);
        top.setMargin(true);
        top.addStyleName(GlobalConstants.toolbar_style);
        top.addStyleName("selectedMenuBanner");
        top.addStyleName("lightGrayFourSideBorder");
        
        addComponent(top);
        top.addComponent(title);
        top.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
        top.setExpandRatio(title, 1); */

      
        row = new HorizontalLayout();
        row.setHeight("100%");
        row.setWidth("100%");
        row.setMargin(new MarginInfo(true, true, false, true));
        row.setSpacing(true);
        
        Panel p = new Panel();
        p.setSizeFull();
        p.setContent(row);
        //p.addStyleName("fourSideWhiteBorder");
        
        addComponent(p);
        setExpandRatio(p, 1.5f);
        setComponentAlignment(p, Alignment.MIDDLE_CENTER);
        
        //Imagevi
        
        ExternalResource img;
        List<ExternalResource> images = new ArrayList<ExternalResource>();
        
        img = new ExternalResource("http://localhost:8084/safe-pro/VAADIN/themes/dashboard/img/m2.jpg");
        images.add(img);
        
        img = new ExternalResource("http://localhost:8084/safe-pro/VAADIN/themes/dashboard/img/about.jpeg");
        images.add(img);
        
        img = new ExternalResource("http://localhost:8084/safe-pro/VAADIN/themes/dashboard/img/dashboard-pie.png");
        images.add(img);
        
        img = new ExternalResource("http://localhost:8084/safe-pro/VAADIN/themes/dashboard/img/inside-logo.jpg");
        images.add(img);
        
        img = new ExternalResource("http://localhost:8084/safe-pro/VAADIN/themes/dashboard/img/learnMore-Topics.jpg");
        images.add(img);
        
        img = new ExternalResource("http://localhost:8084/safe-pro/VAADIN/themes/dashboard/img/m1.jpg");
        images.add(img);
        
        
        
        
        ImageViewer imageViewer_1 = new ImageViewer();
        imageViewer_1.setImmediate(false);
        imageViewer_1.setWidth("100.0%");
        imageViewer_1.setHeight("420px");
        row.addComponent(imageViewer_1);
        
        
        imageViewer_1.setImages(images);
        imageViewer_1.setCaption("Image Gallery");
        imageViewer_1.requestRepaint();
        imageViewer_1.focus();
        

    }

    private CssLayout createPanel(Component content) {
        CssLayout panel = new CssLayout();
        panel.setSizeFull();
        panel.addComponent(content);
        return panel;
    }

   

    @Override
    public void layoutClick(LayoutEvents.LayoutClickEvent event) 
    {
        Component c = event.getComponent();
        
    }
}
